import { createRouter, createWebHashHistory } from "vue-router";


//1.声明routers配置，一个routes是一个数组，routes对象里面的基本属性由path和component组成
let routes=[
    
    {
        path:"/",
        component:()=>import("../pages/home/index.vue"),
        name:"/",
        meta:{
            //meta里的东西可以随便添
            name:'导航首页',
        },
        children:[
            {
                path:"discover",
                component:()=>import("../pages/discover/index.vue"),
                redirect:"/discover/playlist",
                name:'discover',
                meta:{
                    name:'发现首页'
                },
                children:[
                {
                path:"playlist",
                component:()=>import("../pages/discover/palylist/index.vue"),
                name:'playlist',
                meta:{
                    name:"歌单"
                }
            }
                ]
            },
            {
                path:"mine",
                component:()=>import("../pages/mine/index.vue"),
                name:"mine",
                meta:{
                    name:"个人中心"
                },
            },
            {
                props:true,//路由解耦合
                path:"friend/:id",
                component:()=>import("../pages/friend/index.vue"),
                name:"friend",
                meta:{
                    name:"朋友"
                },
            },
        ]
    },
    {
        path:'/login',
        component:()=>import("../pages/login/index.vue"),
        name:"login",
        meta:{
            name:"登入页"
        },
    },
    
]
//2.创建路由
const router=createRouter({
    history:createWebHashHistory("/base"),
    routes
})
//3.导出路由
export default router